package com.billow.events
{
	import com.billow.net.Client;
	
	import flash.events.Event;
	import flash.net.Socket;
	import flash.utils.ByteArray;
	
	public class ServerEvent extends Event
	{
		/** 客户端登录 */
		public static const LOGIN:String = "login";
		/** 客户端离开 */
		public static const CLOSE:String = "close";
		/** 接收客户端数据 */
		public static const RECEIVE:String = "receive";
		/** 服务器打开成功 */
		public static const SUCCEED:String = "succeed";
		/** 服务器打开失败 */
		public static const FAILED:String = "failed";
		
		private var _client:Client;
		
		public function ServerEvent(type:String, client:Client=null, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
			_client = client;
		}
		
		
		/** 远程设备的 IP 地址 */
		public function get remoteAddress():String {return _client.remoteAddress;}
		/** 远程设备的端口 */
		public function get remotePort():int {return _client.remotePort;}
		/** 参数 */
		public function get data():ByteArray {return _client.data;}
		/** 命令 */
		public function get cmd():String {return _client.cmd;}
	}
}